import React from "react"
import {
  View,
  Text,
  TouchableNativeFeedback
} from 'react-native'
import { connect } from 'react-redux';
import PropTypes from 'prop-types';

import UserService from '@/services/UserService'
import NavigationService from '@/services/NavigationService'

class TestScreen extends React.Component {
    render() {
      const username = UserService.getUserName();
      return (
        <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
          <Text>{ username }</Text>
          <TouchableNativeFeedback
              onPress={()=>{
                NavigationService.navigate('Home',{name: 'home'})
                UserService.setUserName("back from test")
              }}
            >
            <View style={{width: 150, height: 100, backgroundColor: 'red'}}>
              <Text style={{margin: 30}}>Button</Text>
            </View>
          </TouchableNativeFeedback>
        </View>
      )
    }
  }

const mapStateToProps = state => ({
    isLoggedIn: state.auth.isLoggedIn,
    name: state.auth.name,
});

export default connect(mapStateToProps)(TestScreen);